import {request} from '@pkg/request/src';

export enum Api {
  page = '/model/page',
  list = '/model/list',
  get = '/model/get',
  save = '/model/save',
  update = '/model/update',
  init = '/model/init',
  remove = '/model/remove',
}

/**
 * 保存或更新
 * @param params
 * @param isUpdate
 */
export const saveOrUpdate = (params, isUpdate) => {
  const url = isUpdate ? Api.update : Api.save;
  return request.post({url: url, params});
};

/**
 * 同步车型库
 */
export const syncModel = () => {
  return request.post({url: Api.init});
};

/**
 * 查询详情
 * @param params
 */
export const getBusModel = (params) => {
  return request.get({url: Api.get, params});
};
